# !/usr/bin/env python
# -*- coding: utf-8 -*-

# @File   : ymlparse.py
# @Time   : 2022/5/24 4:38 下午
# @Author : yujianhui
import yaml

from frame.utils import pathutil


def parse(yaml_path:str) -> dict[str:dict[str:str]]:
    """
    解析yaml
    :param yaml_path: 项目下的yaml路径
    :return:
    """
    # 获取项目根路径
    root=pathutil.project_root_path()
    # 获取yaml路径
    yml_path=pathutil.path_join(root,yaml_path)
    with open(yml_path) as f:
        yml=yaml.safe_load(f)
    if not yml:
        raise RuntimeError("解析yaml失败，解析结果为空")
    return yml


if __name__=='__main__':
    # yml=parse('config/conf.yaml')
    # print(yml)
    pass
